package org.fangzz.cameramgr.cameramonitor.rest;

import org.fangzz.cameramgr.cameramonitor.dto.FfmpegProcessSummay;
import org.fangzz.cameramgr.cameramonitor.service.FfmpegProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.stream.Collectors;

/**
 * 转码进程管理服务
 * Created by cengruilin on 2018/6/12.
 */

@RestController
@RequestMapping("/api")
public class FfmpegProcessRestController {
    @Autowired
    private FfmpegProcessService ffmpegProcessService;

    /**
     * 获取所有转码进程摘要信息
     *
     * @return
     */
    @GetMapping("/ffmpegProcesses")
    public Collection<FfmpegProcessSummay> findAll() {
        return ffmpegProcessService.findAll().stream()
                .map(FfmpegProcessSummay::from)
                .collect(Collectors.toList());
    }
}
